
package presentacion.vista;


import presentacion.util.Ventana;
import java.util.List;
import accesoDatos.vo.Producto;
import accesoDatos.vo.Empleado;
import accesoDatos.vo.Pedido;
import accesoDatos.dao.DaoProducto;
import accesoDatos.dao.DaoEmpleado;
import accesoDatos.dao.DaoPedido;
import accesoDatos.util.Archivo;
import accesoDatos.util.Log;
import java.awt.Image;
import java.io.File;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import logicaNegocio.servicios.BuscarPorCampo;
import logicaNegocio.servicios.MenuDelDia;
import presentacion.vista.filechooser.MyFileChooser;

/**
 *
 * @author  Familia
 */
public class VistaAdministrador extends javax.swing.JFrame {

    private DialogoCambiarContraseña cambiarContraseña = null;
    private MyFileChooser fileChooser = null;
    private Empleado empleado = null;
    
    /** Creates new form VistaAdministrador */
    public VistaAdministrador(Empleado empleado) {
        initComponents();
        this.empleado = empleado;
        tabsCRUD.remove(tabModificar);
        radioProductoCrear.doClick();
        botonCrear.setVisible(false);
        generarMenuDelDia();
        
        Log.setEvento("Servidor","INFO","Se Ejecuta Interfaz de Administrador");
        Ventana.pantallaCompleta(this);
    }

    private void crearEmpleado() {
        Empleado empleado=new Empleado();
        empleado.setNombre(campoCrear2.getText());
        empleado.setPassword(campoCrear3.getText());
        empleado.setCargo(campoCrear4.getText());
        empleado.setTelefono(campoCrear5.getText());
        empleado.setCelular(campoCrear6.getText());
        
        DaoEmpleado.create(empleado);     
        
    }

    private void crearProducto() {
        Producto producto=new Producto();
        producto.setNombre(campoCrear2.getText());
        producto.setTipo(campoCrear3.getText());
        producto.setPrecio(Double.parseDouble(campoCrear4.getText()));
        if(campoCrear5.getText().equals("Si"))
            producto.setEstaEnMenu(true);
        else
            producto.setEstaEnMenu(false);
        
        if(campoCrear6.getText().equals("Si"))
            producto.setEliminado(true);
        else
            producto.setEliminado(false);
        int id = DaoProducto.readAll().size()+1;
        
        File file = new File("../AccesoDatosServidor/src/accesoDatos/vo/fotos/"+id+".jpg");
        if(file.exists()){
            producto.setFoto(new ImageIcon("../AccesoDatosServidor/src/accesoDatos/vo/fotos/"+id+".jpg"));
            DaoProducto.create(producto);
        }
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
     private javax.swing.table.DefaultTableModel generarCamposTabla()
     {
         javax.swing.table.DefaultTableModel modeloTabla = new javax.swing.table.DefaultTableModel();
         
         if(radioProducto.isSelected())
         {
             modeloTabla.addColumn("id");
             modeloTabla.addColumn("Nombre");             
             modeloTabla.addColumn("Tipo");  
             modeloTabla.addColumn("Precio");
             modeloTabla.addColumn("EstaEnMenu");
             modeloTabla.addColumn("Eliminado");                          
         }
         if(radioEmpleado.isSelected())
         {
             modeloTabla.addColumn("id");
             modeloTabla.addColumn("Nombre");              
             modeloTabla.addColumn("Cargo");
             modeloTabla.addColumn("Telefono");
             modeloTabla.addColumn("Celular");     
             
         }
         if(radioVenta.isSelected())
         {
             modeloTabla.addColumn("id");
             modeloTabla.addColumn("Mesa");             
             modeloTabla.addColumn("EnCurso");  
             modeloTabla.addColumn("Fecha");
             modeloTabla.addColumn("Empleado");              
         }
         return modeloTabla;
     }

    private void generarMenuDelDia() {
        javax.swing.table.DefaultTableModel modeloTabla = new javax.swing.table.DefaultTableModel();
         modeloTabla.addColumn("id");
         modeloTabla.addColumn("Nombre");             
         modeloTabla.addColumn("Tipo");  
         modeloTabla.addColumn("Precio");
         
         List<Producto> menu=MenuDelDia.getMenuDelDia();
         modeloTabla.setRowCount(menu.size());
                
                    for(int fila = 0 ; fila < menu.size() ; fila++){
                        modeloTabla.setValueAt(menu.get(fila).getId(), fila ,0);
                        modeloTabla.setValueAt(menu.get(fila).getNombre(), fila ,1);
                        modeloTabla.setValueAt(menu.get(fila).getTipo(), fila ,2);
                        modeloTabla.setValueAt(menu.get(fila).getPrecio(), fila ,3);                   
                    }                
                    tablaMenu.setModel(modeloTabla);         
         
    }
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelDatosEmpleado = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        n = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        c = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        i = new javax.swing.JTextField();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        tabsCRUD = new javax.swing.JTabbedPane();
        tabConsultar = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        tablaBuscar = new javax.swing.JTable();
        jPanel7 = new javax.swing.JPanel();
        radioEmpleado = new javax.swing.JRadioButton();
        radioProducto = new javax.swing.JRadioButton();
        radioVenta = new javax.swing.JRadioButton();
        jPanel6 = new javax.swing.JPanel();
        botonBuscar = new javax.swing.JButton();
        comboBoxCampos = new javax.swing.JComboBox();
        campoBuscar = new javax.swing.JTextField();
        tabCrear = new javax.swing.JPanel();
        botonCrear = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        radioEmpleadoCrear = new javax.swing.JRadioButton();
        radioProductoCrear = new javax.swing.JRadioButton();
        jPanel4 = new javax.swing.JPanel();
        campoCrear2 = new javax.swing.JTextField();
        campoCrear3 = new javax.swing.JTextField();
        campoCrear4 = new javax.swing.JTextField();
        campoCrear5 = new javax.swing.JTextField();
        campoCrear6 = new javax.swing.JTextField();
        labelCrear2 = new javax.swing.JLabel();
        labelCrear3 = new javax.swing.JLabel();
        labelCrear4 = new javax.swing.JLabel();
        labelCrear5 = new javax.swing.JLabel();
        labelCrear6 = new javax.swing.JLabel();
        botonAgregarImagen = new javax.swing.JButton();
        labelFoto = new javax.swing.JLabel();
        tabModificar = new javax.swing.JPanel();
        jTextField2 = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jTextField5 = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jTextField6 = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTextField7 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        botonModificar = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        botonAgregar = new javax.swing.JButton();
        botonQuitar = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        tablaMenu = new javax.swing.JTable();
        jPanel2 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jPanel10 = new javax.swing.JPanel();
        Mesa5 = new javax.swing.JToggleButton();
        Mesa6 = new javax.swing.JToggleButton();
        Mesa7 = new javax.swing.JToggleButton();
        Mesa8 = new javax.swing.JToggleButton();
        jPanel11 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jPanel12 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        botonCerrarAplicacion = new javax.swing.JButton();
        botonCambiarContraseña = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Interfaz Administrador"); // NOI18N
        setResizable(false);
        setUndecorated(true);

        panelDatosEmpleado.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos Empleado", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 2, 12), new java.awt.Color(102, 102, 102)));

        jLabel2.setText("Nombre : "); // NOI18N

        n.setEditable(false);
        n.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel3.setText("Cargo : "); // NOI18N

        c.setEditable(false);
        c.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel4.setText("ID : "); // NOI18N

        i.setEditable(false);
        i.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        javax.swing.GroupLayout panelDatosEmpleadoLayout = new javax.swing.GroupLayout(panelDatosEmpleado);
        panelDatosEmpleado.setLayout(panelDatosEmpleadoLayout);
        panelDatosEmpleadoLayout.setHorizontalGroup(
            panelDatosEmpleadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelDatosEmpleadoLayout.createSequentialGroup()
                .addGap(56, 56, 56)
                .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(n, javax.swing.GroupLayout.PREFERRED_SIZE, 388, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(133, 133, 133)
                .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(c, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(139, 139, 139)
                .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(i, javax.swing.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE)
                .addGap(98, 98, 98))
        );
        panelDatosEmpleadoLayout.setVerticalGroup(
            panelDatosEmpleadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelDatosEmpleadoLayout.createSequentialGroup()
                .addGroup(panelDatosEmpleadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(i)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(c)
                    .addComponent(n))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.setFont(new java.awt.Font("Tahoma", 0, 18));

        jLabel5.setFont(new java.awt.Font("Tahoma", 2, 14));
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel5.setText("Menú del Día"); // NOI18N

        jLabel6.setFont(new java.awt.Font("Tahoma", 2, 14));
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6.setText("Actualización"); // NOI18N

        tabsCRUD.setTabPlacement(javax.swing.JTabbedPane.RIGHT);

        tablaBuscar.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane5.setViewportView(tablaBuscar);

        radioEmpleado.setText("Empleado"); // NOI18N
        radioEmpleado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioEmpleadoActionPerformed(evt);
            }
        });

        radioProducto.setText("Producto"); // NOI18N
        radioProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioProductoActionPerformed(evt);
            }
        });

        radioVenta.setText("Venta"); // NOI18N
        radioVenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioVentaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(radioVenta)
                    .addComponent(radioEmpleado)
                    .addComponent(radioProducto))
                .addContainerGap(32, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(radioProducto)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(radioEmpleado)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(radioVenta)
                .addContainerGap())
        );

        botonBuscar.setText("Buscar"); // NOI18N
        botonBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonBuscarActionPerformed(evt);
            }
        });

        comboBoxCampos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(campoBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botonBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(comboBoxCampos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(comboBoxCampos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonBuscar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout tabConsultarLayout = new javax.swing.GroupLayout(tabConsultar);
        tabConsultar.setLayout(tabConsultarLayout);
        tabConsultarLayout.setHorizontalGroup(
            tabConsultarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabConsultarLayout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47))
            .addGroup(tabConsultarLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 510, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(52, Short.MAX_VALUE))
        );
        tabConsultarLayout.setVerticalGroup(
            tabConsultarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabConsultarLayout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(tabConsultarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel6, 0, 75, Short.MAX_VALUE)
                    .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE))
                .addGap(39, 39, 39)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 355, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(52, 52, 52))
        );

        tabsCRUD.addTab("<html>\t\n\t<body>\n\t\t<br>C<br>O<br>N<br>S<br>U<br>L<br>T<br>A<br>R<br><br>\t\n\t</body>\t\n</html>", tabConsultar);

        tabCrear.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabCrearMouseClicked(evt);
            }
        });

        botonCrear.setText("Crear"); // NOI18N
        botonCrear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCrearActionPerformed(evt);
            }
        });

        radioEmpleadoCrear.setText("Empleado"); // NOI18N
        radioEmpleadoCrear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioEmpleadoCrearActionPerformed(evt);
            }
        });

        radioProductoCrear.setText("Producto"); // NOI18N
        radioProductoCrear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioProductoCrearActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(radioEmpleadoCrear, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(radioProductoCrear, javax.swing.GroupLayout.Alignment.LEADING))
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(radioProductoCrear)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(radioEmpleadoCrear)
                .addContainerGap())
        );

        campoCrear2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoCrear2ActionPerformed(evt);
            }
        });
        campoCrear2.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                campoCrear2KeyPressed(evt);
            }
        });

        campoCrear3.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                campoCrear3KeyPressed(evt);
            }
        });

        campoCrear4.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                campoCrear4KeyPressed(evt);
            }
        });

        campoCrear5.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                campoCrear5KeyPressed(evt);
            }
        });

        campoCrear6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoCrear6ActionPerformed(evt);
            }
        });
        campoCrear6.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                campoCrear6KeyPressed(evt);
            }
        });

        labelCrear2.setText("jLabel7"); // NOI18N

        labelCrear3.setText("jLabel7"); // NOI18N

        labelCrear4.setText("jLabel7"); // NOI18N

        labelCrear5.setText("jLabel7"); // NOI18N

        labelCrear6.setText("jLabel7"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap(38, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addComponent(labelCrear3, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoCrear3, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addComponent(labelCrear2, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoCrear2, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addComponent(labelCrear5, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoCrear5, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addComponent(labelCrear4, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoCrear4, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addComponent(labelCrear6, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoCrear6, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, 0))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelCrear2, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoCrear2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelCrear3, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoCrear3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelCrear4, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoCrear4, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelCrear5, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoCrear5, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelCrear6, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoCrear6, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        botonAgregarImagen.setText("Agregar Imagen");
        botonAgregarImagen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonAgregarImagenActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(botonAgregarImagen, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(89, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(botonAgregarImagen)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        labelFoto.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout tabCrearLayout = new javax.swing.GroupLayout(tabCrear);
        tabCrear.setLayout(tabCrearLayout);
        tabCrearLayout.setHorizontalGroup(
            tabCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabCrearLayout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addComponent(labelFoto, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 253, Short.MAX_VALUE)
                .addComponent(botonCrear, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47))
            .addGroup(tabCrearLayout.createSequentialGroup()
                .addGap(75, 75, 75)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(38, 38, 38))
        );
        tabCrearLayout.setVerticalGroup(
            tabCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabCrearLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                .addGroup(tabCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(botonCrear, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelFoto, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26))
        );

        tabsCRUD.addTab("<html>\t\n\t<body>\n\t\t<br>C<br>R<br>E<br>A<br>R<br><br>\t\n\t</body>\t\n</html>", tabCrear);

        jLabel7.setText("jLabel7"); // NOI18N

        jLabel8.setText("jLabel7"); // NOI18N

        jLabel9.setText("jLabel7"); // NOI18N

        jLabel10.setText("jLabel7"); // NOI18N

        jLabel11.setText("jLabel7"); // NOI18N

        botonModificar.setText("Modificar"); // NOI18N

        javax.swing.GroupLayout tabModificarLayout = new javax.swing.GroupLayout(tabModificar);
        tabModificar.setLayout(tabModificarLayout);
        tabModificarLayout.setHorizontalGroup(
            tabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabModificarLayout.createSequentialGroup()
                .addGap(82, 82, 82)
                .addGroup(tabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabModificarLayout.createSequentialGroup()
                        .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(tabModificarLayout.createSequentialGroup()
                        .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(tabModificarLayout.createSequentialGroup()
                        .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(tabModificarLayout.createSequentialGroup()
                        .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(tabModificarLayout.createSequentialGroup()
                        .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(155, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabModificarLayout.createSequentialGroup()
                .addContainerGap(397, Short.MAX_VALUE)
                .addComponent(botonModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47))
        );
        tabModificarLayout.setVerticalGroup(
            tabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabModificarLayout.createSequentialGroup()
                .addGap(81, 81, 81)
                .addGroup(tabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 150, Short.MAX_VALUE)
                .addComponent(botonModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(98, 98, 98))
        );

        tabsCRUD.addTab("<html>\t\n\t<body>\n\t\t<br>M<br>O<br>D<br>I<br>F<br>I<br>C<br>A<br>R<br><br>\t\n\t</body>\t\n</html>", tabModificar);

        botonAgregar.setFont(new java.awt.Font("Tahoma", 1, 14));
        botonAgregar.setText("<---  Agregar");
        botonAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonAgregarActionPerformed(evt);
            }
        });

        botonQuitar.setFont(new java.awt.Font("Tahoma", 1, 14));
        botonQuitar.setText("Quitar --->");
        botonQuitar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonQuitarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap(11, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(botonQuitar, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE)
                    .addComponent(botonAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(11, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(botonAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 118, Short.MAX_VALUE)
                .addComponent(botonQuitar, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        tablaMenu.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane2.setViewportView(tablaMenu);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 425, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(72, 72, 72)
                        .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(480, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tabsCRUD, javax.swing.GroupLayout.PREFERRED_SIZE, 601, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(17, 17, 17))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 542, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tabsCRUD, javax.swing.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(151, 151, 151)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        tabsCRUD.getAccessibleContext().setAccessibleName("<html>\t\n\t<body>\n\t\t<br>C<br>O<br>N<br>S<br>U<br>L<br>T<br>A<br>R<br>\n\t</body>\t\n</html>");

        jTabbedPane1.addTab("ADMINISTRADOR", jPanel1);

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        jScrollPane3.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane3.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        Mesa5.setFont(new java.awt.Font("Tahoma", 0, 18));
        Mesa5.setText("Mesa 1"); // NOI18N
        Mesa5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        Mesa5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                Mesa5MouseClicked(evt);
            }
        });
        Mesa5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Mesa5ActionPerformed(evt);
            }
        });

        Mesa6.setFont(new java.awt.Font("Tahoma", 0, 18));
        Mesa6.setText("Mesa 2"); // NOI18N
        Mesa6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Mesa6ActionPerformed(evt);
            }
        });

        Mesa7.setFont(new java.awt.Font("Tahoma", 0, 18));
        Mesa7.setText("Mesa 3"); // NOI18N
        Mesa7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Mesa7ActionPerformed(evt);
            }
        });

        Mesa8.setFont(new java.awt.Font("Tahoma", 0, 18));
        Mesa8.setText("Mesa 4"); // NOI18N
        Mesa8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Mesa8ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(Mesa8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Mesa7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Mesa6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Mesa5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE))
                .addContainerGap(50, Short.MAX_VALUE))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addComponent(Mesa5, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Mesa6, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Mesa7, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Mesa8, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(734, Short.MAX_VALUE))
        );

        jScrollPane3.setViewportView(jPanel10);

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addContainerGap(11, Short.MAX_VALUE)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Factura", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 2, 12), new java.awt.Color(102, 102, 102)));

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("TOTAL"); // NOI18N

        jTextField1.setEditable(false);

        jButton1.setFont(new java.awt.Font("Tahoma", 0, 18));
        jButton1.setText("Cerrar Pedido"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 215, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(54, 54, 54)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 283, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(23, 23, 23))
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
                    .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 858, Short.MAX_VALUE)
                        .addGap(34, 34, 34))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(29, Short.MAX_VALUE))))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)
                .addGap(12, 12, 12)
                .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(33, 33, 33))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGap(5, 5, 5))
        );

        jTabbedPane1.addTab("CAJERO", jPanel2);

        jButton5.setFont(new java.awt.Font("Tahoma", 0, 18));
        jButton5.setText("Cerrar Sesion"); // NOI18N
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        botonCerrarAplicacion.setFont(new java.awt.Font("Tahoma", 0, 18));
        botonCerrarAplicacion.setText("Cerrar Aplicación"); // NOI18N
        botonCerrarAplicacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCerrarAplicacionActionPerformed(evt);
            }
        });

        botonCambiarContraseña.setFont(new java.awt.Font("Tahoma", 0, 18));
        botonCambiarContraseña.setText("Cambiar Contraseña"); // NOI18N
        botonCambiarContraseña.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCambiarContraseñaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap(67, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(botonCambiarContraseña, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(botonCerrarAplicacion, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(panelDatosEmpleado, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1272, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonCerrarAplicacion, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonCambiarContraseña, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 618, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(panelDatosEmpleado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-1272)/2, (screenSize.height-768)/2, 1272, 768);
    }// </editor-fold>//GEN-END:initComponents
    

    private void radioProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioProductoActionPerformed
        // TODO add your handling code here:
        radioEmpleado.setSelected(false);
        radioVenta.setSelected(false);    
        campoBuscar.setText("");
        if(!radioEmpleado.isSelected() && !radioVenta.isSelected())
            radioProducto.setSelected(true);
        
        comboBoxCampos.removeAllItems();
        comboBoxCampos.addItem("id");
        comboBoxCampos.addItem("nombre");
        comboBoxCampos.addItem("tipo");
        comboBoxCampos.addItem("precio");
        comboBoxCampos.addItem("estaEnMenu");
        comboBoxCampos.addItem("eliminado");
        
                javax.swing.table.DefaultTableModel modeloTabla = new javax.swing.table.DefaultTableModel();
        
                List<Producto> productos= new ArrayList<Producto>();     
                productos=DaoProducto.readAll();
                modeloTabla=generarCamposTabla();
                modeloTabla.setRowCount(productos.size());
                String estaEnMenu="";
                String eliminado="";
                
                for(int fila = 0 ; fila < productos.size() ; fila++){
                    if(productos.get(fila).getEliminado()==true)
                        eliminado="Si";
                    else
                        eliminado="No";
                    
                    if(productos.get(fila).getEstaEnMenu()==true)
                        estaEnMenu="Si";
                    else
                        estaEnMenu="No";
                    
                    modeloTabla.setValueAt(productos.get(fila).getId(), fila ,0);
                    modeloTabla.setValueAt(productos.get(fila).getNombre(), fila ,1);
                    modeloTabla.setValueAt(productos.get(fila).getTipo(), fila ,2);
                    modeloTabla.setValueAt(productos.get(fila).getPrecio(), fila ,3);
                    modeloTabla.setValueAt(estaEnMenu, fila ,4);
                    modeloTabla.setValueAt(eliminado, fila ,5);         
                }
          tablaBuscar.setModel(modeloTabla);
        
}//GEN-LAST:event_radioProductoActionPerformed

    private void botonBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBuscarActionPerformed
        // TODO add your handling code here:   
        
        javax.swing.table.DefaultTableModel modeloTabla = new javax.swing.table.DefaultTableModel();                              
        String campo= String.valueOf(comboBoxCampos.getSelectedItem());
        String busqueda = campoBuscar.getText();  
      
            if(radioEmpleado.isSelected())
            {
                List<Empleado> empleados=new ArrayList<Empleado>();               
                empleados=BuscarPorCampo.buscarEmpleado(busqueda, campo);                    
                modeloTabla=generarCamposTabla();
                
                if(empleados==null)
                {
                    tablaBuscar.setModel(modeloTabla);
                }
                else{
                    modeloTabla.setRowCount(empleados.size());
                
                    for(int fila = 0 ; fila < empleados.size() ; fila++){
                        modeloTabla.setValueAt(empleados.get(fila).getId(), fila ,0);
                        modeloTabla.setValueAt(empleados.get(fila).getNombre(), fila ,1);
                        modeloTabla.setValueAt(empleados.get(fila).getCargo(), fila ,2);
                        modeloTabla.setValueAt(empleados.get(fila).getTelefono(), fila ,3);
                        modeloTabla.setValueAt(empleados.get(fila).getCelular(), fila ,4);                     
                    }                
                    tablaBuscar.setModel(modeloTabla);
                }                                    
              
            }
            if(radioProducto.isSelected()){
                
                List<Producto> productos=new ArrayList<Producto>();               
                productos=BuscarPorCampo.buscarProducto(busqueda, campo);                    
                modeloTabla=generarCamposTabla();
                String eliminado="",estaEnMenu="";
                
                if(productos==null)
                {
                    tablaBuscar.setModel(modeloTabla);
                }
                else{
                    modeloTabla.setRowCount(productos.size());
                
                    for(int fila = 0 ; fila < productos.size() ; fila++){
                        if(productos.get(fila).getEliminado())
                            eliminado="Si";
                        else
                            eliminado="No";
                    
                        if(productos.get(fila).getEstaEnMenu())
                            estaEnMenu="Si";
                        else
                            estaEnMenu="No";
                        
                        modeloTabla.setValueAt(productos.get(fila).getId(), fila ,0);
                        modeloTabla.setValueAt(productos.get(fila).getNombre(), fila ,1);
                        modeloTabla.setValueAt(productos.get(fila).getTipo(), fila ,2);
                        modeloTabla.setValueAt(productos.get(fila).getPrecio(), fila ,3);
                        modeloTabla.setValueAt(estaEnMenu, fila ,4);                     
                        modeloTabla.setValueAt(eliminado, fila ,5);                     
                    }                
                    tablaBuscar.setModel(modeloTabla);
                }  
               
            }
            if(radioVenta.isSelected()){
               
                List<Pedido> pedidos=new ArrayList<Pedido>();                      
                pedidos=BuscarPorCampo.buscarPedido(busqueda, campo);                    
                modeloTabla=generarCamposTabla();                
                String enCurso="";                
                 
                if(pedidos==null)
                {
                    tablaBuscar.setModel(modeloTabla);
                }
                else{       
                    modeloTabla.setRowCount(pedidos.size());
                    for(int fila = 0 ; fila < pedidos.size() ; fila++){
                        if(pedidos.get(fila).getEnCurso())
                            enCurso="Si";
                        else
                            enCurso="No";
                    
                        modeloTabla.setValueAt(pedidos.get(fila).getId(), fila ,0);
                        modeloTabla.setValueAt(pedidos.get(fila).getMesa(), fila ,1);
                        modeloTabla.setValueAt(enCurso, fila ,2);
                        modeloTabla.setValueAt(pedidos.get(fila).getFecha(), fila ,3);
                        modeloTabla.setValueAt(pedidos.get(fila).getEmpleado().getNombre(), fila ,4);   
                    }
                    tablaBuscar.setModel(modeloTabla);
                }
            }
            
                                                                                                      
}//GEN-LAST:event_botonBuscarActionPerformed

    
    private void radioEmpleadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioEmpleadoActionPerformed
        // TODO add your handling code here:
        radioProducto.setSelected(false);
        radioVenta.setSelected(false);    
        campoBuscar.setText("");
         if(!radioProducto.isSelected() && !radioVenta.isSelected())
            radioEmpleado.setSelected(true);
        
        comboBoxCampos.removeAllItems();
        comboBoxCampos.addItem("id");
        comboBoxCampos.addItem("nombre");
        comboBoxCampos.addItem("cargo");
        comboBoxCampos.addItem("telefono");
        comboBoxCampos.addItem("celular");

        
        javax.swing.table.DefaultTableModel modeloTabla = new javax.swing.table.DefaultTableModel();
        
                List<Empleado> empleados=new ArrayList<Empleado>();
                empleados=DaoEmpleado.readAll();
                modeloTabla=generarCamposTabla();
                modeloTabla.setRowCount(empleados.size());
                
                
                for(int fila = 0 ; fila < empleados.size() ; fila++){
                    modeloTabla.setValueAt(empleados.get(fila).getId(), fila ,0);
                    modeloTabla.setValueAt(empleados.get(fila).getNombre(), fila ,1);
                    modeloTabla.setValueAt(empleados.get(fila).getCargo(), fila ,2);
                    modeloTabla.setValueAt(empleados.get(fila).getTelefono(), fila ,3);
                    modeloTabla.setValueAt(empleados.get(fila).getCelular(), fila ,4);                         
                }
          tablaBuscar.setModel(modeloTabla);
}//GEN-LAST:event_radioEmpleadoActionPerformed

    private void radioVentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioVentaActionPerformed
        // TODO add your handling code here:
        radioEmpleado.setSelected(false);
        radioProducto.setSelected(false);
        campoBuscar.setText("");
         if(!radioEmpleado.isSelected() && !radioProducto.isSelected())
            radioVenta.setSelected(true);
        
        comboBoxCampos.removeAllItems();
        comboBoxCampos.addItem("id");
        comboBoxCampos.addItem("mesa");
        comboBoxCampos.addItem("enCurso");
        comboBoxCampos.addItem("fecha");
        comboBoxCampos.addItem("empleado");
                
        javax.swing.table.DefaultTableModel modeloTabla = new javax.swing.table.DefaultTableModel();
        
                List<Pedido> pedidos=new ArrayList<Pedido>();
                pedidos=DaoPedido.readAll();
                modeloTabla=generarCamposTabla();
                modeloTabla.setRowCount(pedidos.size());
                String enCurso="";
                
                for(int fila = 0 ; fila < pedidos.size() ; fila++){
                    if(pedidos.get(fila).getEnCurso()==true)
                        enCurso="Si";
                    else
                        enCurso="No";
                    
                    modeloTabla.setValueAt(pedidos.get(fila).getId(), fila ,0);
                    modeloTabla.setValueAt(pedidos.get(fila).getMesa(), fila ,1);
                    modeloTabla.setValueAt(enCurso, fila ,2);
                    modeloTabla.setValueAt(pedidos.get(fila).getFecha(), fila ,3);
                    modeloTabla.setValueAt(pedidos.get(fila).getEmpleado().getNombre(), fila ,4);                           
                }
          tablaBuscar.setModel(modeloTabla);
}//GEN-LAST:event_radioVentaActionPerformed

    private void radioProductoCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioProductoCrearActionPerformed
        // TODO add your handling code here:
        botonAgregarImagen.setEnabled(true);
        radioEmpleadoCrear.setSelected(false);
        if(!radioEmpleadoCrear.isSelected())
            radioProductoCrear.setSelected(true);
        

        labelCrear2.setText("Nombre");
        labelCrear3.setText("Tipo");
        labelCrear4.setText("Precio");
        labelCrear5.setText("EstaEnMenu");
        labelCrear6.setText("Eliminado");
        campoCrear2.setText("");
        campoCrear3.setText("");
        campoCrear4.setText("");
        campoCrear5.setText("");
        campoCrear6.setText("");
        
        botonCrear.setVisible(false);
        
}//GEN-LAST:event_radioProductoCrearActionPerformed

    private void radioEmpleadoCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioEmpleadoCrearActionPerformed
        // TODO add your handling code here:
        botonAgregarImagen.setEnabled(false);
        radioProductoCrear.setSelected(false);
        if(!radioProductoCrear.isSelected())
            radioEmpleadoCrear.setSelected(true);
        
        labelCrear2.setText("Nombre");
        labelCrear3.setText("Password");
        labelCrear4.setText("Cargo");
        labelCrear5.setText("Telefono");
        labelCrear6.setText("Celular");
        campoCrear2.setText("");
        campoCrear3.setText("");
        campoCrear4.setText("");
        campoCrear5.setText("");
        campoCrear6.setText("");
        
        botonCrear.setVisible(false);
}//GEN-LAST:event_radioEmpleadoCrearActionPerformed

    private void Mesa5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Mesa5MouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_Mesa5MouseClicked

    private void Mesa5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Mesa5ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Mesa5ActionPerformed

    private void Mesa6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Mesa6ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Mesa6ActionPerformed

    private void Mesa7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Mesa7ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Mesa7ActionPerformed

    private void Mesa8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Mesa8ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Mesa8ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        Log.setEvento("Servidor","INFO","Se Cierra Interfaz de Administrador");
        IniciarSesion i = new IniciarSesion();
        Log.setEvento("Servidor","INFO","Se Ejecuta Interfaz de Iniciar Sesion.");
        i.llamarIniciarSesion();
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void botonCerrarAplicacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCerrarAplicacionActionPerformed
        // TODO add your handling code here:
        Log.setEvento("Servidor","INFO","Se Cierra la Apliacion");
        System.exit(1);        
}//GEN-LAST:event_botonCerrarAplicacionActionPerformed

    private void botonAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAgregarActionPerformed
        // TODO add your handling code here:
        if(radioProducto.isSelected()){
            for(int i=0;i<tablaBuscar.getRowCount();i++)
            {
                if(tablaBuscar.isRowSelected(i))
                {
                    String id=String.valueOf(tablaBuscar.getValueAt(i,0));
                    MenuDelDia.agregarAMenu(id);        
                }
                
            }                
        }
        radioProducto.doClick();
        generarMenuDelDia();
    }//GEN-LAST:event_botonAgregarActionPerformed

    private void botonQuitarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonQuitarActionPerformed
        // TODO add your handling code here:
         for(int i=0;i<tablaMenu.getRowCount();i++)
            {
                if(tablaMenu.isRowSelected(i))
                {
                    String id=String.valueOf(tablaMenu.getValueAt(i,0));
                    MenuDelDia.quitarDeMenu(id);        
                }
                
            }                             
        radioProducto.doClick();
        generarMenuDelDia();                
    }//GEN-LAST:event_botonQuitarActionPerformed

    private void tabCrearMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabCrearMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_tabCrearMouseClicked

    private void botonCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCrearActionPerformed
        // TODO add your handling code here:
        if(radioProductoCrear.isSelected())
            crearProducto();
            
        if(radioEmpleadoCrear.isSelected())
            crearEmpleado();
            
            
    }//GEN-LAST:event_botonCrearActionPerformed

    private void campoCrear6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoCrear6ActionPerformed
        // TODO add your handling code here:               
}//GEN-LAST:event_campoCrear6ActionPerformed

    private void campoCrear2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoCrear2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoCrear2ActionPerformed

    private void campoCrear2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoCrear2KeyPressed
        // TODO add your handling code here:
         if(!campoCrear3.getText().equals("")&& !campoCrear4.getText().equals("")&& !campoCrear5.getText().equals("")&& !campoCrear6.getText().equals(""))
        {        
            botonCrear.setVisible(true);
        }
    }//GEN-LAST:event_campoCrear2KeyPressed

    private void campoCrear3KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoCrear3KeyPressed
        // TODO add your handling code here:
         if(!campoCrear2.getText().equals("")&& !campoCrear4.getText().equals("")&& !campoCrear5.getText().equals("")&& !campoCrear6.getText().equals(""))
        {        
            botonCrear.setVisible(true);
        }
    }//GEN-LAST:event_campoCrear3KeyPressed

    private void campoCrear4KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoCrear4KeyPressed
        // TODO add your handling code here:
         if(!campoCrear2.getText().equals("") && !campoCrear3.getText().equals("")&& !campoCrear5.getText().equals("")&& !campoCrear6.getText().equals(""))
        {        
            botonCrear.setVisible(true);
        }
    }//GEN-LAST:event_campoCrear4KeyPressed

    private void campoCrear5KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoCrear5KeyPressed
        // TODO add your handling code here:
         if(!campoCrear2.getText().equals("") && !campoCrear3.getText().equals("")&& !campoCrear4.getText().equals("")&& !campoCrear6.getText().equals(""))
        {        
            botonCrear.setVisible(true);
        }
    }//GEN-LAST:event_campoCrear5KeyPressed

    private void campoCrear6KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoCrear6KeyPressed
        // TODO add your handling code here:
        if(!campoCrear2.getText().equals("") && !campoCrear3.getText().equals("")&& !campoCrear4.getText().equals("")&& !campoCrear5.getText().equals(""))
        {        
            botonCrear.setVisible(true);
        }
        
    }//GEN-LAST:event_campoCrear6KeyPressed

    private void botonCambiarContraseñaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCambiarContraseñaActionPerformed
        if (cambiarContraseña == null){
            cambiarContraseña = new DialogoCambiarContraseña(this,true);
        }
        cambiarContraseña.resetAll();
        cambiarContraseña.setEmpleado(this.empleado);
        cambiarContraseña.pack();
        cambiarContraseña.setVisible(true);
}//GEN-LAST:event_botonCambiarContraseñaActionPerformed

    private void botonAgregarImagenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAgregarImagenActionPerformed
       if(fileChooser == null){
           fileChooser = new MyFileChooser();
       }
       File file = fileChooser.getFile(new File(System.getProperty("user.home")), this);
       
       if (file!= null){
            System.out.println(file.getPath());
            ImageIcon tmpIcon = new ImageIcon(file.getPath());
            ImageIcon thumbnail = new ImageIcon(tmpIcon.getImage().getScaledInstance(100, -1, Image.SCALE_DEFAULT));
            labelFoto.setIcon(thumbnail);
            int id = DaoProducto.readAll().size()+1;
            Archivo.copiar(new File(file.getPath()), new File("../AccesoDatosServidor/src/accesoDatos/vo/fotos/"+id+".jpg"));
       }
}//GEN-LAST:event_botonAgregarImagenActionPerformed
       
    /**
     * @param args the command line arguments
     */
    public static void main(final Empleado empleado) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VistaAdministrador(empleado).setVisible(true);               
                
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToggleButton Mesa5;
    private javax.swing.JToggleButton Mesa6;
    private javax.swing.JToggleButton Mesa7;
    private javax.swing.JToggleButton Mesa8;
    private javax.swing.JButton botonAgregar;
    private javax.swing.JButton botonAgregarImagen;
    private javax.swing.JButton botonBuscar;
    private javax.swing.JButton botonCambiarContraseña;
    private javax.swing.JButton botonCerrarAplicacion;
    private javax.swing.JButton botonCrear;
    private javax.swing.JButton botonModificar;
    private javax.swing.JButton botonQuitar;
    private javax.swing.JTextField c;
    private javax.swing.JTextField campoBuscar;
    private javax.swing.JTextField campoCrear2;
    private javax.swing.JTextField campoCrear3;
    private javax.swing.JTextField campoCrear4;
    private javax.swing.JTextField campoCrear5;
    private javax.swing.JTextField campoCrear6;
    private javax.swing.JComboBox comboBoxCampos;
    private javax.swing.JTextField i;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JTextField jTextField7;
    private javax.swing.JLabel labelCrear2;
    private javax.swing.JLabel labelCrear3;
    private javax.swing.JLabel labelCrear4;
    private javax.swing.JLabel labelCrear5;
    private javax.swing.JLabel labelCrear6;
    private javax.swing.JLabel labelFoto;
    private javax.swing.JTextField n;
    private javax.swing.JPanel panelDatosEmpleado;
    private javax.swing.JRadioButton radioEmpleado;
    private javax.swing.JRadioButton radioEmpleadoCrear;
    private javax.swing.JRadioButton radioProducto;
    private javax.swing.JRadioButton radioProductoCrear;
    private javax.swing.JRadioButton radioVenta;
    private javax.swing.JPanel tabConsultar;
    private javax.swing.JPanel tabCrear;
    private javax.swing.JPanel tabModificar;
    private javax.swing.JTable tablaBuscar;
    private javax.swing.JTable tablaMenu;
    private javax.swing.JTabbedPane tabsCRUD;
    // End of variables declaration//GEN-END:variables
    
}
